package com.cdgc.web.service.Impl;

import com.cdgc.web.mapper.SpMapper;
import com.cdgc.web.pojo.Sp;
import com.cdgc.web.service.SpService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SpServiceImpl implements SpService {
    @Resource
    private SpMapper spMapper;
    @Override
    public List<Sp> queryAllSps() {
        return spMapper.selectByExample(null);
    }

    @Override
    public Sp querySpsById(Integer id) {
        return spMapper.selectByPrimaryKey(id);
    }

    @Override
    public void deleteSpById(Integer id) {
        spMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void UpdateSp(Sp sp) {
        spMapper.updateByPrimaryKey(sp);
    }

    @Override
    public void addNewSp(Sp sp) {
        spMapper.insert(sp);
    }
}
